//
//  HJSearchView.swift
//  HJWeiBo
//
//  Created by 夏航军 on 16/9/22.
//  Copyright © 2016年 夏航军. All rights reserved.
//

import UIKit

//@IBInspectable 定义可视化属性
//@IBDesignable 让可视化属性时时刷新
 @IBDesignable class HJSearchView: UIButton {

    //定义类方法要加Class
   class func loadSearchView () -> HJSearchView {
       
        let nib = UINib(nibName: "HJSearchView", bundle: nil)
        let searchView = nib.instantiate(withOwner: nil, options: nil).last as! HJSearchView
        
        return searchView
        
    }
  

    //当视图被激活的时候会调用此方法
    override func awakeFromNib() {
        //设置文字和图片的内边距
        self.imageEdgeInsets = UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 0)
        self.titleEdgeInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 0)
        
        //设置宽度
        self.bounds.size.width = UIScreen.main.bounds.width
        
        
        //设置圆角
       // self.layer.cornerRadius = 17
    }
}
